import {FormItemRule} from 'element-plus';
import {ComponentMap, SelectOptionsMap} from './constants';

/** 选择器类型 */
export type ISelectMapKey = keyof typeof SelectOptionsMap;
/** 自定义组件类型 */
export type IComponentMapKey = keyof typeof ComponentMap;

/** 表单配置项 */
export interface IFormSchema {
  [key: string]: {
    type: ISelectMapKey | IComponentMapKey;
    label: string;
    value: any;
    rules?: FormItemRule[];
    placeholder?: string;
    required?: boolean;
    disabled?: boolean;
    style?: string;
    isWholeRow?: boolean;
  };
}

export type IFromItem = IFormSchema[keyof IFormSchema];

export type IFormSchemaType = IFromItem['type'];

export interface ISelectOptionItem {
  label: string;
  value: string | number;
}
